package com.ruoyi.project.wf.enums;

import java.util.HashMap;
import java.util.Map;

public enum WfProcessActType {
	Start(0, "开始节点") {
		public boolean isStartState() {
			return true;
		}

		
	},
	Finished(2, "结束节点") {
	

		public boolean isFinishState() {
			return true;
		}
	},
	ManulNode(3, "人工节点") {
	
	},

	SubFlowDef(4, "子流程") {
		

	},
	VirtualNode(5, "虚拟节点") {
		

	};

	public static WfProcessActType toWfProcessActType(Integer value) {
		return codeMap.get(value);
	}

	public static String getNameByCode(Integer value) {
		WfProcessActType type = codeMap.get(value);
		if (type != null) {
			return type.getName();
		}
		return "未知状态";
	}

	private static Map<Integer, WfProcessActType> codeMap;
	private static Map<String, WfProcessActType> nameMap;
	static {
		codeMap = new HashMap<Integer, WfProcessActType>();
		nameMap = new HashMap<String, WfProcessActType>();
		for (WfProcessActType type : WfProcessActType.values()) {
			codeMap.put(type.getValue(), type);
			nameMap.put(type.getName(), type);
		}
	}
	private Integer value;
	private String name;

	private WfProcessActType(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		return name;
	}

	public String toString() {
		return this.getValue() + "-" + this.getName();
	}

	public  boolean isStartState() {
		return false;
	}

	public  boolean isFinishState() {
		return false;
	}

	public static void main(String[] args) {
		for (WfProcessActType type : WfProcessActType.values()) {
			//System.out.println(type);
		}
	}
}
